Type-Based Allocation Analysis for Co-recursion in Lazy Functional Languages
نویسندگان
چکیده
This paper presents a novel type-and-effect analysis for predicting upper-bounds on memory allocation costs for co-recursive definitions in a simple lazily-evaluated functional language. We show the soundness of this system against an instrumented variant of Launchbury’s semantics for lazy evaluation which serves as a formal cost model. Our soundness proof requires an intermediate semantics employing indirections. Our proof of correspondence between these semantics that we provide is thus a crucial part of this work. The analysis has been implemented as an automatic inference system. We demonstrate its effectiveness using several example programs that previously could not be automatically analysed.
منابع مشابه
Purely functional data structures
When a C programmer needs an efficient data structure for a particular problem, he or she can often simply look one up in any of a number of good textbooks or handbooks. Unfortunately, programmers in functional languages such as Standard ML or Haskell do not have this luxury. Although some data structures designed for imperative languages such as C can be quite easily adapted to a functional se...
متن کاملImprovement in a Lazy Context: an Operational Theory for Call-by-need (extended Version)
The standard implementation technique for lazy functional languages is call-by-need, which ensures that an argument to a function in any given call is evaluated at most once. A signiicant problem with call-by-need is that it is diicult | even for compiler writers | to predict the eeects of program transformations. The traditional theories for lazy functional languages are based on call-by-name ...
متن کاملImprovement in a Lazy
The standard implementation technique for lazy functional languages is call-by-need, which ensures that an argument to a function in any given call is evaluated at most once. A signiicant problem with call-by-need is that it is diicult | even for compiler writers | to predict the eeects of program transformations. The traditional theories for lazy functional languages are based on call-by-name ...
متن کاملDeciding subset relationship of co-inductively defined set constants
Static analysis of different non-strict functional programming languages makes use of set constants like Top, Inf, and Bot denoting all expressions, all lists without a last Nil as tail, and all non-terminating programs, respectively. We use a set language that permits union, constructors and recursive definition of set constants with a greatest fixpoint semantics. This paper proves decidabilit...
متن کاملOptimising Recursive Functions Yielding Multiple Results in Tuples in a Lazy Functional Language
We discuss a new optimisation for recursive functions yielding multiple results in tuples for lazy functional languages, like Clean and Haskell. This optimisation improves the execution time of such functions and also reduces the amount of memory allocated in the heap by these functions, which reduces garbage collection costs. In some cases execution time is improved by more than a factor of tw...
متن کامل